import Axios from 'axios'

export function ImportUser(file) {
  return Axios.request({
    url: 'http://1.12.49.243/manage/getImgMess',
    method: 'POST',
    header: {
      'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
    },
    data: file
  })
}

export function getBase64(file) {
  return new Promise(function(resolve, reject) {
    const reader = new FileReader()
    let imgResult = ''
    reader.readAsDataURL(file)
    reader.onload = function() {
      imgResult = reader.result
    }
    reader.onerror = function(error) {
      reject(error)
    }
    reader.onloadend = function() {
      resolve(imgResult)
    }
  })
}

